//
//  DemoVC2Cell.m
//  XHWebImageAutoSizeExample
//
//  Created by zhuxiaohui on 2016/11/20.
//  Copyright © 2016年 it7090.com. All rights reserved.
//

#import "DemoVC2Cell.h"
//#import "NewsModel.h"
#import "NSLayoutConstraint+FF.h"
@implementation DemoVC2Cell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.followBnt.layer.cornerRadius = AdaptX(12);
    self.followBnt.layer.masksToBounds = YES;
    
    self.logo.layer.cornerRadius = AdaptX(22);
    self.logo.layer.masksToBounds = YES;
//    self.zanBtn.backgroundColor = [UIColor redColor];
    [self.zanBtn setImageEdgeInsets:UIEdgeInsetsMake(0, -3, 0, 0)];
    [self.zanBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 3, 0, 0)];
    UIButton *palyBtn = [[UIButton alloc] init];
    [palyBtn setImage:LBImage(@"play") forState:UIControlStateNormal];
    [self.contentView addSubview:palyBtn];
    [palyBtn makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.imgView);
        make.centerY.mas_equalTo(self.imgView);
        make.size.mas_equalTo(CGSizeMake(AdaptX(40), AdaptX(40)));
    }];
    
    self.nameLab.textColor = rgb(51,51,51);
    self.nameLab.font = [UIFont systemFontOfSize:AdaptX(15)];
    self.timeLab.textColor = rgb(102,102,102);
    self.timeLab.font = [UIFont systemFontOfSize:AdaptX(12)];
    
    self.contentLab.textColor = rgb(51,51,51);
    self.contentLab.font = [UIFont systemFontOfSize:AdaptX(15)];
    
    self.detailLab.textColor = rgb(102,102,102);
    self.detailLab.font = [UIFont systemFontOfSize:AdaptX(15)];
    
    self.titleLab.textColor = rgb(102,102,102);
    self.titleLab.font = [UIFont systemFontOfSize:AdaptX(14)];
    
    UIImageView *vipImageV = [[UIImageView alloc]init];
    vipImageV.image = [UIImage imageNamed:@"wk_vip"];
    vipImageV.contentMode = UIViewContentModeScaleAspectFill;
    vipImageV.clipsToBounds = YES;
    _vipImageV = vipImageV;
    [self.contentView addSubview:vipImageV];
    vipImageV.userInteractionEnabled = NO;
    vipImageV.layer.cornerRadius = AdaptX(7.5);
    vipImageV.layer.masksToBounds = YES;
    [vipImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.logo).offset(0);
        make.size.mas_equalTo(CGSizeMake(AdaptX(15), AdaptX(15)));
        make.bottom.mas_equalTo(self.logo);
    }];
    
    UIView *footersectionView = [UIView new];
    footersectionView.backgroundColor = rgb(242,242,242);
    [self.contentView addSubview:footersectionView];
    [footersectionView makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.height.mas_equalTo(10);
    }];

}
- (void)setModel:(WKHotmenModel *)model{
    _model = model;
    
    if ([model.isVip integerValue]==1) {
        _vipImageV.hidden = NO;
    }else{
        _vipImageV.hidden = YES;
    }
    NSString *urlString = [NSString stringWithFormat:@"%@%@",Public_URL,model.headImg];
    [self.logo sd_setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[[UserModel getUserModel].sex integerValue]==0 ? [UIImage imageNamed:@"vkgirl"] : [UIImage imageNamed:@"vkboy"]];
    self.timeLab.text = [model.clockDate substringToIndex:10];
    self.nameLab.text = model.username;
    self.contentLab.text = model.clockTitle;
    self.detailLab.text = model.clockOrtherTitle;
    if (model.clockInfoVOList.count>0) {
        //底部描述
        WKHotclockInfoVOListModel *model2 = model.clockInfoVOList[0];
        self.titleLab.text = model2.infoContent;
    }
    if ([model.isAtten isEqualToString:@"1"]) {
        [self.followBnt setTitle:@"取消关注" forState:UIControlStateNormal];
//        [self.followBnt setTitleColor:rgb(153,153,153) forState:UIControlStateNormal]
    }else{
        [self.followBnt setTitle:@"关注" forState:UIControlStateNormal];
    }
    if ([model.isPrase isEqualToString:@"1"]) {
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_Fabulous"] forState:UIControlStateNormal];
    }else{
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_unFabulous"] forState:UIControlStateNormal];
    }
    [self.zanBtn setTitle:model.praiseNum forState:UIControlStateNormal];
    
}
- (void)setFollowModel:(WKHotmenModel *)followModel{
    _followModel = followModel;
    if ([followModel.isVip integerValue]==1) {
        _vipImageV.hidden = NO;
    }else{
        _vipImageV.hidden = YES;
    }
    NSString *urlString = [NSString stringWithFormat:@"%@%@",Public_URL,followModel.headImg];
    [self.logo sd_setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[[UserModel getUserModel].sex integerValue]==0 ? [UIImage imageNamed:@"vkgirl"] : [UIImage imageNamed:@"vkboy"]];
    self.timeLab.text = [followModel.clockDate substringToIndex:10];
    self.nameLab.text = followModel.username;
    self.contentLab.text = followModel.clockTitle;
    self.detailLab.text = followModel.clockOrtherTitle;
    if (followModel.clockInfoVOList.count>0) {
        WKHotclockInfoVOListModel *model2 = followModel.clockInfoVOList[0];
        self.titleLab.text = model2.infoContent;
        
    }
    if ([followModel.isPrase isEqualToString:@"1"]) {
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_Fabulous"] forState:UIControlStateNormal];
    }else{
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_unFabulous"] forState:UIControlStateNormal];
    }
    [self.zanBtn setTitle:followModel.praiseNum forState:UIControlStateNormal];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
